<template>
	<view>
<!-- 		<mSearch @search="search($event,0)"></mSearch>
		<view class="page-content">
			<view @tap="orderbyChange" :class="{'text-theme': hasChoose}">
				<span></span>筛选按钮
			</view>
			<fjj-condition ref='condition' @touchmove.stop :color="color" :list="menuList" @result="resultConditon" />
		</view> -->
		<view class="cu-card dynamic" :class="isCard?'no-card':''" v-for="(item,i) in taskList" :key="i">
			<view class="cu-item shadow">
				<view class="cu-list menu-avatar">
					<view class="cu-item">
						<view class="content">
							<view class="text-sl">{{item.title}}</view>
							<view class="text-gray text-sm flex justify-between">
								{{item.createTime}}
							</view>
						</view>
					</view>
				</view>
				<view class="text-content">
					{{ item.content }}
				</view>
				<view class="text-gray text-sm text-right padding">
					<button class="cu-btn round text-blue" @click="look(item.id)">完成任务</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import fjjCondition from '@/components/fjj-condition/fjj-condition.vue';
	import mSearch from '@/components/mehaotian-search/mehaotian-search.vue';
	export default {
		components: {
			mSearch,
			fjjCondition
		},
		data() {
			return {
				// val0: '',
				// placeholder: '请输入搜索内容',
				taskList: [],
				// color: '#4D7BFE',
				// hasChoose: false,
				// menuList: [{
				// 		'title': '日期范围',
				// 		'type': 'range',
				// 		'key': 'time1',
				// 	},
				// 	{
				// 		'title': '日期范围带时间',
				// 		'type': 'rangetime',
				// 		'key': 'time2',
				// 	},
				// 	{
				// 		'title': '日期',
				// 		'type': 'date',
				// 		'key': 'time3',
				// 	},
				// 	{
				// 		'title': '成绩范围',
				// 		'type': 'rangenumber',
				// 		'key': 'count',
				// 	}
				// ]
			}
		},
		created() {
			this.getData();
		},
		methods: {
			getData() {
				let stuId = 1
				stuId = uni.getStorageSync('stuId');
				uni.request({
					url: 'http://localhost:8082/task_admin/task/queryAllByStuId?stuId=' + stuId,
					// data: this.searchForm,
					// dataType: 'json',
					// method: 'POST',
					success: (res) => {
						// console.log(res)
						if (res.data.code == 200) {
							this.taskList = res.data.data
						}
					}
				})
			},
			look(id) {
				uni.navigateTo({
					url: '/pages/student/task-item?taskId=' + id
				});
			},
			// search(e, val) {
			// 	console.log(e, val);
			// 	this['val' + val] = e;
			// },
			//筛选返回值
			// resultConditon(obj) {
			// 	this.$refs.condition.visibleDrawer = false;
			// 	this.hasChoose = obj.hasChoose;
			// 	console.log(obj);
			// },
			// orderbyChange(obj) {
			// 	this.$refs.condition.visibleDrawer = true;
			// }
		}
	}
</script>

<style>
</style>
